<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/commonHead :: commonHead('列表管理')"></head>
<body>
<div th:replace="/common/titleNav :: titleNavDiv"></div>
<div class="content" th:with="oneMenu='2',twoMenu='5'">
    <div th:replace="/common/sidebarNav :: sidebarDiv"></div>
    <div class="main">
        <div class="right">
            <ol class="breadcrumb" style="margin-top:15px;">
                <li><a th:href="@{/listName/list}">列表管理</a></li>
                <li class="active">列表</li>
            </ol>
            <ul id="myTab" class="nav nav-tabs">
                <li class="active base">
                    <a href="#base" data-toggle="tab">
                        基本信息
                    </a>
                </li>
                <li class="simpleList" th:if="${entity?.id != null and entity?.listType == 0}">
                    <a href="#simpleList" data-toggle="tab">
                        列表项
                    </a>
                </li>
                <li class="treeList" th:if="${entity?.id != null and entity?.listType == 1}">
                    <a href="#treeList" data-toggle="tab">
                        列表项
                    </a>
                </li>
            </ul>
            <div id="tabContent" class="tab-content">
                <div class="tab-pane active" id="base" th:include="/admin/listName/tab_base :: base"></div>
                <div class="tab-pane" id="simpleList" th:if="${entity?.id != null and entity?.listType == 0}" th:include="/admin/listName/tab_simpleList :: simpleList"></div>
                <div class="tab-pane" id="treeList" th:if="${entity?.id != null and entity?.listType == 1}" th:include="/admin/listName/tab_treeList :: treeList"></div>
            </div>
        </div>
    </div>
</div>

<form th:action="@{/listName/edit}" method="post" id="tabForm">
    <input type="hidden" name="id" th:value="${entity?.id}"/>
    <input type="hidden" name="tab" value=""/>
    <input type="hidden" name="sPage" th:value="${listNameDto.sPage}"/>
    <input type="hidden" name="sRows" th:value="${listNameDto.sRows}"/>
    <input type="hidden" name="name" th:value="${param.name}"/>
    <input type="hidden" name="description" th:value="${param.description}"/>
    <input type="hidden" name="enabled" th:value="${param.enabled}"/>
    <input type="hidden" name="listType" th:value="${param.listType}"/>
    <input type="hidden" name="apiName" th:value="${param.apiName}"/>
    <input type="hidden" name="page" th:value="${param.page}"/>
    <input type="hidden" name="rows" th:value="${param.rows}"/>
</form>

<form th:action="@{/listName/list}" method="post" id="backForm">
    <input type="hidden" name="name" th:value="${param.name}"/>
    <input type="hidden" name="description" th:value="${param.description}"/>
    <input type="hidden" name="enabled" th:value="${param.enabled}"/>
    <input type="hidden" name="listType" th:value="${param.listType}"/>
    <input type="hidden" name="apiName" th:value="${param.apiName}"/>
    <input type="hidden" name="page" th:value="${param.page}"/>
    <input type="hidden" name="rows" th:value="${param.rows}"/>
</form>

<!-- 模态框（Modal） -->
<div class="modal fade" id="batchAddSimpleList" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">批量添加列表项</h4>
            </div>
            <div class="modal-body">
                格式：值1:[描述]:[排序编号],值2:[描述]:[排序编号],... 或 值1,值2,值3
                <textarea rows="4" cols="100" id="simpleListEntryValues" placeholder="请输入"></textarea>
                <span id="simpleListTip" style="display: block; color: #c62828;"></span>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="batchSaveSimpleList">确定</button>
                <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" id="addSimpleList" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">添加列表项</h4>
            </div>
            <div class="modal-body">
                <form action="" id="simpleListForm">
                    <input type="hidden" name="id"/>
                    <input type="hidden" name="listId" th:value="${entity?.id}"/>
                    <div class="pop-search-list">
                        <div class="form-group">
                            <label class="control-label">列表值：</label>
                            <input class="form-control s" type="text" name="entryValue" placeholder="请输入"/>
                            <span id="simpleEntryTip" style="color: #c62828;"></span>
                        </div>
                        <div class="form-group">
                            <label class="control-label">列表描述：</label>
                            <input class="form-control s" type="text" name="description" placeholder="请输入"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">排序编号：</label>
                            <input class="form-control s" type="text" name="sortNumber" placeholder="请输入"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">apiName：</label>
                            <input class="form-control s" type="text" name="apiName" placeholder="请输入"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">状态：</label>
                            <select name="enabled">
                                <option value="0">禁用</option>
                                <option value="1" selected>启用</option>
                            </select>
                        </div>
                        <div class="btn-group-box">
                            <button type="button" class="btn btn-primary" id="saveSimpleList">确定</button>
                            <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- 模态框（Modal） -->
<div class="modal fade" id="batchAddTreeList" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">批量添加列表项</h4>
            </div>
            <div class="modal-body">
                格式：值1:[描述]:[排序编号],值2:[描述]:[排序编号],... 或 值1,值2,值3
                <textarea rows="4" cols="100" id="treeListEntryValues" placeholder="请输入"></textarea>
                <span id="treeListTip" style="display: block; color: #c62828;"></span>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="batchSaveTreeList">确定</button>
                <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="addTreeList" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">添加列表项</h4>
            </div>
            <div class="modal-body">
                <form action="" id="treeListForm">
                    <input type="hidden" name="id"/>
                    <input type="hidden" name="listId" th:value="${entity?.id}"/>
                    <input type="hidden" name="listNameApi" th:value="${entity?.apiName}"/>
                    <input type="hidden" name="parentId" value="0"/>
                    <input type="hidden" name="update"/>
                    <div class="pop-search-list">
                        <div class="form-group">
                            <label class="control-label">列表值：</label>
                            <input class="form-control s" type="text" name="entryValue" placeholder="请输入"/>
                            <span id="treeEntryTip" style="color: #c62828;"></span>
                        </div>
                        <div class="form-group">
                            <label class="control-label">列表描述：</label>
                            <input class="form-control s" type="text" name="description" placeholder="请输入"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">排序编号：</label>
                            <input class="form-control s" type="text" name="sortNumber" placeholder="请输入"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">apiName：</label>
                            <input class="form-control s" type="text" name="apiName" placeholder="请输入"/>
                        </div>
                        <div class="form-group">
                            <label class="control-label">状态：</label>
                            <select name="enabled">
                                <option value="0">禁用</option>
                                <option value="1" selected>启用</option>
                            </select>
                        </div>
                        <div class="btn-group-box">
                            <button type="button" class="btn btn-primary" id="saveTreeList">确定</button>
                            <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>
    <script type="text/javascript" th:src="@{/static/javascript/admin/listName/edit.js}"></script>
</body>
</html>